import 'dart:io';

import 'package:short_drama/utils/global_util.dart';
import 'package:short_drama/utils/http_util.dart';

class InviteModel {}

class InviteViewModel {
  Future<String> fetchInviteData() async {
    final data = await HttpUtil().get('sys/link');
    final url = data.data['link'];
    return url;
  }
}

class ServiceViewModel {
  Future<String> fetchProfitData() async {
    try {
      final response = await HttpUtil().get(
        'sys/customer',
        params: {"token": GlobalUtil.userToken},
      );
      final dynamic responseData = response.data['data']; // 明确类型声明
      final String? imageUrl = responseData['image'] as String?;
      if (imageUrl == null) {
        throw Exception('Image URL not found in response');
      }
      return imageUrl;
    } catch (e) {
      throw '';
    }
  }
}
